package com.atguigu.springcloud.controller;

import com.atguigu.springcloud.client.ProviderClient2;
import com.atguigu.springcloud.entities.DeptDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping(value = "/v2")
public class MyTestController2 {

    @Autowired
    private ProviderClient2 providerClient2;

    @RequestMapping(value = "/dept/get/{id}")
    public DeptDto get(@PathVariable("id") Long id) {
        return this.providerClient2.get(id);
    }

    @RequestMapping(value = "/dept/list")
    public List<DeptDto> list() {
        return this.providerClient2.list();
    }

    @RequestMapping(value = "/dept/add")
    public Object add(DeptDto dept) {
        return this.providerClient2.add(dept);
    }
}
